 import Taro, { Component } from '@tarojs/taro'
import { Swiper, SwiperItem, Image, View, Text ,RichText } from '@tarojs/components'
import CommonJs from '../../utils/common'
import '../../assets/common.scss'
import foot01 from '../../assets/kedouimg01/foot11.png'
import foot01c from '../../assets/kedouimg01/foot11c.png'
import foot02 from '../../assets/kedouimg01/foot08.png'
import foot02c from '../../assets/kedouimg01/foot08c.png'
import foot03 from '../../assets/kedouimg01/foot07.png'
import foot03c from '../../assets/kedouimg01/foot07c.png'
import foot04 from '../../assets/kedouimg01/foot10.png'
import foot04c from '../../assets/kedouimg01/foot10c.png'
import foot05 from '../../assets/kedouimg01/foot09.png'
import foot05c from '../../assets/kedouimg01/foot09c.png'
export default class footer extends Component {	
 constructor(props) {
    super(props);
    this.state = {
		nav:0,
		navlist:[],
		isIphoneX:0,
        appmark:CommonJs.getmark()
    }
  }

  componentWillMount () {
  	const app = Taro.getApp();
  	let isIphoneX = app.globalData.isIphoneX;
  	this.setState({
     	nav:this.props.porpNav,
     	isIphoneX:isIphoneX
   })
  	this.getnavan()
  }
  componentDidShow () {

  }
  shouldComponentUpdate () {
  }
  componentWillUnmount () {

  }
  open(url){
	CommonJs.open(url)
  }
  opens(url,types){
	if(types){
		var webinfo=Taro.getStorageSync('webinfo')
		if(webinfo){
			CommonJs.open(types)
				
		}
		else{
			CommonJs.open(url)
		}
	}
	else{
		CommonJs.open(url)
	}
  }
  getnavan(){
		var url='/advert/papi/v1.9/part/dealerPart/3'
		var _this=this
		CommonJs.ajaxRequest(url,'','GET',function(res){
			_this.setState({
        navlist: res.data,
      })
		})
	}
  render () {
	const nav=this.state.nav;
	const appmark=this.state.appmark
	const navlist=this.state.navlist
    return(
     <View className='footer' style={this.state.isIphoneX==1?'padding-bottom:58rpx':''}>
		<View className='footer-con'>
		<View className={nav==0?'footer-dl footer-dlcur':'footer-dl'}  onClick={this.open.bind(this,'/pages/xijia/grouplist')}>
			<View className='footer-dt'>
				<Image className='footer-img' mode='widthFix' src={nav==0?foot01c:foot01}></Image>
			</View>
			<View className='footer-dd'>首页</View>
		</View>
		<View className={nav==1?'footer-dl footer-dlcur':'footer-dl'} onClick={this.open.bind(this,'/pages/xijia/gxl')}>
			<View className='footer-dt'>
				<Image className='footer-img' mode='widthFix' src={nav==1?foot02c:foot02}></Image>
			</View>
			<View className='footer-dd'>产品链</View>
		</View>
		<View className={nav==2?'footer-dl footer-dlcur':'footer-dl'} onClick={this.open.bind(this,'/pages/xijia/gxc')}>
			<View className='footer-dt'>
				<Image className='footer-img' mode='widthFix' src={nav==2?foot03c:foot03}></Image>
			</View>
			<View className='footer-dd'>产品仓</View>
		</View>
		<View className={nav==3?'footer-dl footer-dlcur':'footer-dl'} onClick={this.open.bind(this,'/pages/xijia/gxq')}>
			<View className='footer-dt'>
				<Image className='footer-img' mode='widthFix' src={nav==3?foot04c:foot04}></Image>
			</View>
			<View className='footer-dd'>产品圈</View>
		</View>
		<View className={nav==4?'footer-dl footer-dlcur':'footer-dl'} onClick={this.open.bind(this,'/pages/my/my')}>
			<View className='footer-dt'>
				<Image className='footer-img' mode='widthFix' src={nav==4?foot05c:foot05}></Image>
			</View>
			<View className='footer-dd'>我的</View>
		</View>
		</View>

		
	</View>
    )
  }
}
